<template>
    <el-cascader :placeholder="placeholder" v-model="value" :rules="rules" :options="options" :props="cascaderProps" clearable :style="{ width: width }" />
</template>

<script setup lang="ts">
import type { CascaderProps, FormRules } from "element-plus";

//双向数据绑定
const value = defineModel<Array<any>>({ type: Array, default: [] });

interface Props {
    options: Array<any>;
    cascaderProps?: CascaderProps;
    width?: string;
    placeholder?: string;
    rules?: Array<FormRules> | null;
}
withDefaults(defineProps<Props>(), {
    options: () => [],
    cascaderProps: () => ({}),
    width: "100%",
    placeholder: "请选择",
    rules: null,
});
</script>

<style scoped lang="less"></style>
